#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define mp make_pair
using namespace std;
typedef unsigned long long ull;
template<class T,class S>
bool chmax(T &a,const S b) {return (a<b?a=b,1:0);}
template<class T,class S>
bool chmin(T &a,const S b) {return (a>b?a=b,1:0);}

#define int long long
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
typedef pair<int,int> pii;  
typedef vector<int> vi;
typedef vector<pii> vp;
int read() {
  int x=0,w=1; char c=getchar(); 
  while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
  while(isdigit(c)) {x=x*10+(c-'0'); c=getchar();} 
  return x*w;
}

const int N=3e5+5;
int n,m,Q,a[N],l[N],r[N];

namespace Brute {
  int b[N],g[N];
  void solve() {
    rep(i,1,Q) {
      int t=0;
      rep(j,l[i],r[i]) b[++t]=a[j];
      b[0]=b[t+1]=0; int sum=0;
      rep(i,1,t) {
        g[i]=g[i-1]+max(0ll,b[i]-b[i-1]);
        if(i>=m) chmax(g[i],g[i-m]+b[i]);
      }
      printf("%lld\n",g[t]);
    }
  }
}

namespace Inc {
  int t[N];
  void solve() {
    rep(i,1,n) t[i]=(i>=m?t[i-m]:0)+a[i];
    rep(i,1,Q) {
      if((r[i]-l[i])%m==0) {
        printf("%lld\n",a[l[i]]+t[r[i]]-t[l[i]]);
      } else {
        int pl=l[i]/m*m+r[i]%m;
        if(pl<l[i]) pl+=m;
        printf("%lld\n",a[pl]+t[r[i]]-t[pl]);
      }
    }
  }
}

signed main() {
  freopen("clear.in","r",stdin);
  freopen("clear.out","w",stdout);
  n=read(), m=read(), Q=read();
  rep(i,1,n) a[i]=read();
  rep(i,1,Q) l[i]=read(), r[i]=read();
  if(n<=5000&&Q<=5000) {
    Brute::solve();
    return 0;
  }
  Inc::solve();
  return 0;
}